package com.jdjw.modules.ruralnail.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.jdjw.modules.ruralnail.entity.SouStaMigrantWorkers;
import com.jdjw.modules.ruralnail.mapper.SouStaMigrantWorkersMapper;
import com.jdjw.modules.ruralnail.service.SouStaMigrantWorkersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.log4j.Log4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 临时务工 服务实现类
 * </p>
 *
 * @author guxinao
 * @since 2021-07-06
 */
@Service
@Log4j
@DS("zkyr-xz-mszj")
public class SouStaMigrantWorkersServiceImpl extends ServiceImpl<SouStaMigrantWorkersMapper, SouStaMigrantWorkers> implements SouStaMigrantWorkersService {

    @Resource
    SouStaMigrantWorkersMapper souStaMigrantWorkersMapper;

    @Override
    public ArrayList method() {

        //查询
        List<SouStaMigrantWorkers> result = souStaMigrantWorkersMapper.selectListSql();

        ArrayList list = new ArrayList();
        try{
            for (SouStaMigrantWorkers a:result){

                if(!"0".equals(a.getJe()) || a.getJe()!=null){
                    //单位是元--->万元
                    float f = Double.valueOf(a.getJe()).floatValue();
                    a.setJe(String.valueOf(f/10000));
                }else{
                    a.setJe("0");
                }
                list.add(a);
            }
        }catch (Exception e){
            log.info("数据问题，临时务工-处理失败");
            e.printStackTrace();
        }

        return list;
    }
}
